export default class AppAudio {

    public static play(id: string, successCallback: any = {}, errorCallback: any = {}): boolean {
        try {
            plugins.NativeAudio.play(id, successCallback, errorCallback);
            return true;
        } catch (e) {
            return false;
        }
    }

    public static init(): void {
        try {
            plugins.NativeAudio.preloadComplex('newMsg', require('@/assets/sounds/msn-sound.mp3'), 1, 1, 0, (success: any) => {
                AppAudio.dispatch.push('newMsg');
            });
        } catch (e) {
            AppAudio.dispatch = [];
        }

    }

    private static dispatch: string[] = [];
}
